#include <iostream>
#include <vector>

using namespace std;
// The API isBadVersion is defined for you.
// bool isBadVersion(int version);

class Solution
{
public:
    bool isBadVersion(int version)
    {
        return 1;
    }
    int firstBadVersion(int n)
    {
        int left = 1;
        int right = n;
        while (left < right)
        {
            int mid = left + (right - left) / 2;
            if (isBadVersion(mid))
            {
                right = mid;
            }
            else
            {
                left = mid + 1;
            }
        }
        return left;
    }
};
int main(int argc, char const *argv[])
{

    system("pause");
    return 0;
}
